<template>
  <div class="logo-component" :class="sizeClass">
    <img 
      :src="logoSrc" 
      :alt="alt" 
      class="logo-img"
      @click="$emit('click')"
    />
    <span v-if="showText" class="logo-text">{{ text }}</span>
  </div>
</template>

<script setup>
import { computed } from 'vue'

const props = defineProps({
  size: {
    type: String,
    default: 'medium',
    validator: (value) => ['small', 'medium', 'large', 'xlarge'].includes(value)
  },
  variant: {
    type: String,
    default: 'modern',
    validator: (value) => ['simple', 'modern', 'original'].includes(value)
  },
  showText: {
    type: Boolean,
    default: false
  },
  text: {
    type: String,
    default: 'CMP'
  },
  alt: {
    type: String,
    default: 'CMP Logo'
  }
})

const emit = defineEmits(['click'])

const sizeClass = computed(() => `logo-${props.size}`)

const logoSrc = computed(() => {
  switch (props.variant) {
    case 'title':
      return '/titleLog.png'
    case 'top':
      return '/logo-top.8ad5fc81.png'
    default:
      return '/titleLog.png'
  }
})
</script>

<style lang="scss" scoped>
.logo-component {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  
  .logo-img {
    transition: transform 0.3s ease;
    cursor: pointer;
    
    &:hover {
      transform: scale(1.05);
    }
  }
  
  .logo-text {
    font-weight: 600;
    color: inherit;
  }
  
  // 尺寸变体
  &.logo-small {
    .logo-img {
      width: 32px;
      height: 32px;
    }
    
    .logo-text {
      font-size: 14px;
    }
  }
  
  &.logo-medium {
    .logo-img {
      width: 48px;
      height: 48px;
    }
    
    .logo-text {
      font-size: 16px;
    }
  }
  
  &.logo-large {
    .logo-img {
      width: 60px;
      height: 60px;
    }
    
    .logo-text {
      font-size: 20px;
    }
  }
  
  &.logo-xlarge {
    .logo-img {
      width: 80px;
      height: 80px;
    }
    
    .logo-text {
      font-size: 24px;
    }
  }
}
</style>
